package com.gx.factory.extend;

import java.io.PrintStream;

/**
 * Created by gx on 2017/3/3.
 */
public class MyTest {


    public static void main(String[] args) {
        int a = 10;
        int b = 10;
//        method(a, b);
        System.out.println("a+" + a);
        System.out.println("b+" + b);
    }

    static void method(int a, int b) {
        PrintStream mySream = new PrintStream(System.out) {
            @Override
            public void println(String x) {
                if (x.startsWith("a")) {
                    super.println(x + "a");
                    super.println("a=" + 200);
                }
                if (x.startsWith("b")) {
                    super.println("b=" + 200);
                }
            }
        };
        System.setOut(mySream);
    }


}
